﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using EntityServices;
using Model;

namespace WebApp1.Controllers
{
    public class 学院Controller : ApiController
    {
        // GET api/<controller>
        public 学院Controller():base()
        {

        }
        
        TimeTableOneEntityServicesFactory entityServices=new TimeTableOneEntityServicesFactory();
        public IEnumerable<学院> Get()
        {
            return entityServices.学院Service.GetList();
        }

        // GET api/<controller>/5
        public 学院 Get(int id)
        {
            return entityServices.学院Service.GetById(id);
        }

        // POST api/<controller>
        public void Post([FromBody] 学院 value)
        {
            entityServices.学院Service.NewSave(value);
        }

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]学院 value)
        {
            entityServices.学院Service.Modify(value);
        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
            学院 temp=this.Get(id);
            if(temp!=null)
                entityServices.学院Service.Remove(temp);
        }
    }
}